<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>科研项目管理系统 - 学院管理</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            padding-top: 20px;
        }
        .card {
            margin-bottom: 20px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="card">
        <div class="card-header bg-primary text-white">
            <h1 class="h3">科研项目管理系统</h1>
        </div>
        <div class="card-body">
            <nav class="nav mb-4">
                <a class="nav-link" href="/project/list">项目管理</a>
                <a class="nav-link" href="/project/stats">统计分析</a>
                <a class="nav-link active" href="/college/list">学院管理</a>
            </nav>

            <div class="mb-3">
                <a href="/college/add" class="btn btn-success">新增学院</a>
            </div>

            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>学院名称</th>
                        <th>创建时间</th>
                        <th>更新时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr th:each="college, stat : ${colleges}">
                        <td th:text="${stat.count}"></td>
                        <td th:text="${college.name}"></td>
                        <td th:text="${#dates.format(college.createtime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                        <td th:text="${#dates.format(college.updatetime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                        <td>
                            <a th:href="@{/college/edit/{id}(id=${college.id})}" class="btn btn-sm btn-warning">编辑</a>
                            <a th:href="@{/college/delete/{id}(id=${college.id})}" class="btn btn-sm btn-danger" onclick="return confirm('确定要删除该学院吗？删除后相关项目可能会受到影响。')">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>

            <div th:if="${colleges.empty}" class="text-center text-muted">
                暂无数据
            </div>
        </div>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>